# input("请输入数组和数值:")

# def two_sum(nums, target):
#     lens = len(nums)
#     j = -1
#     for i in range(1, lens):
#         temp = nums[:i]
#         if (target - nums[i]) in temp:
#             j = temp.index(target - nums[i])
#             break
#     if j >= 0:
#         return [j, i]
class Solution:
    def swo_sum(self, nums, target):

        d = {}
        n = len(nums)
        for x in range(n):
            if target - nums[x] in d:
                return d[target-nums[x]], x
            else:
                d[nums[x]] = x



